package com.xjggb.demo.config;


import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfiguration {
 /* *//*
    * 声明注册fanoyut模式交换机
    *
    *
    * *//*
    @Bean
    public FanoutExchange fanoutExchange(){
*//*
* 参数name   表示交换
* 参数 durable 表示消息队列是否持久化 true表示持久化 autoDelete当所有消费客户端连接断开后，是否自动删除 队列 true：删除 false：不删除
* *//*
   return new FanoutExchange("fanout_order_exchange",true,false);
    }
    *//*
    * 声明注册Direct模式交换机
    * *//*
    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("direct_order_exchange",true,false);
    }
  *//*
    * 声明队列
    * *//*
    @Bean
    public Queue smsQueue(){
       return new Queue("sms.fanout.queue",true);
    }
    @Bean
    public Queue emailQueue(){
        return new Queue("emailQueue.fanout.queue",true);
    }
    @Bean
    public Queue duanxinQueue(){
        return new Queue("duanxinQueue.fanout.queue",true);
    }
   *//*
    * 完成绑定关系
    * *//*
    @Bean
    public Binding smsBinding(){
   return BindingBuilder.bind(smsQueue()).to(fanoutExchange());
    }

    @Bean
    public Binding emailBinding(){
        return BindingBuilder.bind(emailQueue()).to(fanoutExchange());
    }
    @Bean
    public Binding duanxinBinding(){
        return BindingBuilder.bind(duanxinQueue()).to(fanoutExchange());
    }
*//*    *//**//*
     * Direct模式交换机完成绑定关系
     * *//**//*
    @Bean
    public Binding smsBinding(){
        return BindingBuilder.bind(smsQueue()).to(directExchange()).with("sms");  //with添加路由key
    }

    @Bean
    public Binding emailBinding(){
        return BindingBuilder.bind(emailQueue()).to(directExchange()).with("email");//with添加路由key
    }
    @Bean
    public Binding duanxinBinding(){
        return BindingBuilder.bind(duanxinQueue()).to(directExchange()).with("dunxin");//with添加路由key
    }*//*
*/

}
